package com.sunk.ytmall.service.impl;

import com.sunk.ytmall.entity.Goods;
import com.sunk.ytmall.entity.Image;
import com.sunk.ytmall.entity.User;
import com.sunk.ytmall.entity.vo.CartVO;
import com.sunk.ytmall.service.ICommonInfoService;
import com.sunk.ytmall.utils.ImgUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author: Sunk 673116067@qq.com
 * @Date: 2018/5/9 14:40
 * @Description:
 */
@Service
public class CommonInfoServiceImpl implements ICommonInfoService{

    //session中User标识
    private final static String USER="user";

    @Autowired
    private ImgUtils imgUtils;

    @Override
    public User getUser(){
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        return  (User) request.getSession().getAttribute(USER);
    }

}
